#include "Digraph.h"
#include <iostream>

using namespace std;

Digraph::Digraph( int _vertices ){
	vertices = _vertices;
	initializeGraph();
}

Digraph::~Digraph(){
	for( int i = 0; i < vertices; i++ ){
		(graph[i]).clear();
	}
	graph.clear();
}

void Digraph::initializeGraph(){
	graph = vector< vector<int> >( vertices, vector<int>(vertices, 2) );
}

void Digraph::insertEdge( int fromVertex, int toVertex ){
	graph[fromVertex][toVertex] = 1;
	graph[toVertex][fromVertex] = -1;
}

void Digraph::insertBidirectionalEdge( int fromVertex, int toVertex ){
	graph[fromVertex][toVertex] = 0;
	graph[toVertex][fromVertex] = 0;
}

void Digraph::deleteEdge( int fromVertex, int toVertex ){
	graph[fromVertex][toVertex] = 0;
	graph[toVertex][fromVertex] = 0;
}

void Digraph::print(){
    for ( int i = 0; i < vertices; i++ ){
        cout << endl;
        for ( int j = 0; j < vertices; j++ ){
            cout << graph[i][j] << " ";
        }
    }
}
